import ElementPlus from 'element-plus'
import { App } from 'vue'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/lib/locale/lang/en'
import store from '../store'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { toLine } from '../utils/index'
export default (app: App) => {
  app.use(ElementPlus, {
    locale: store.getters.language === 'en' ? en : zhCn
  })
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(`el-icon-${toLine(key)}`, component)
  }
}
